import Vue from 'vue'
import Vuex from 'vuex'

import {getClientId,setClientId} from "@/libs/util";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userInfo: {visitorId:getClientId()},
    tenantId: null,
    tenantInfo: {},
    imConnectionState: -1
  },
  mutations: {
    updateVisitorInfo(state,visitor) {
      state.userInfo = visitor
      setClientId(visitor.visitorId)
    },
    updateTenantInfo(state,tenant) {
      state.tenantId = tenant.tenantId
      state.tenantInfo = tenant
    },
    updateImConnectionState(state, s) {
      state.imConnectionState = s
    }
  },
  actions: {
  },
  modules: {

  }
})
